<%--
 * Título: gestHora. Aplicación web de gestión de horarios para conservatorios.
 * Alumnos:
 * - Javier Pardo Muñoz. I.T. Informática de Gestión
 * - Antonio Prior Cazorla. I.T. Informática de Gestión
 * Director: Dr. José Raúl Romero Salguero.
 *     
 *  Copyright (C) 2013 Javier Pardo Muñoz / Antonio Prior Cazorla
 *
 *  This program is free software: you can redistribute it and/or modify
 *  it under the terms of the GNU General Public License as published by
 *  the Free Software Foundation, either version 3 of the License, or
 *  (at your option) any later version.

 *  This program is distributed in the hope that it will be useful,
 *  but WITHOUT ANY WARRANTY; without even the implied warranty of
 *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 *  GNU General Public License for more details.
 *
 *  You should have received a copy of the GNU General Public License
 *  along with this program.  If not, see <http://www.gnu.org/licenses/>.
--%>


<%@page contentType="text/html" pageEncoding="UTF-8"%>
<!DOCTYPE html>

<jsp:useBean id="MsgBean" class="es.uco.gesthora.interfaz.MsgBean" scope="session"/>
<jsp:useBean id="UsuarioBean" class="es.uco.gesthora.interfaz.UsuarioBean" scope="session"/>


<html>

    <head>
        <link rel="stylesheet" type="text/css" href="/gestHora/css/general.css">
        <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
        <link rel="icon" type="image/png" href="/gestHora/img/favicon.png" />

        <script type="text/javascript" src="/gestHora/js/jQuery.js"></script>   
        <script type="text/javascript" src="/gestHora/js/ajax/especialidades.js"></script> 
        <script type="text/javascript" src="/gestHora/js/ajax/asignaturas.js"></script> 
        <script type="text/javascript" src="/gestHora/js/menu.js"></script> 
        <script type="text/javascript" src="/gestHora/js/paginate.js"></script>
        <script type="text/javascript" src="/gestHora/js/tablesort.js"></script>
        <script type="text/javascript" src="/gestHora/js/tablefilter.js"></script>
        <script type="text/javascript" src="/gestHora/js/jQuery.cleditor.js"></script>

        <script type="text/javascript">

            $(document).ready(function() {

                rellenarSelectEspecialidad();
                $('#selectEspecialidad').change(function() {
                    rellenarSelectNombreCursos();
                    $('#selectCurso').removeAttr('disabled');
                    $('#selectAsignatura').removeAttr('disabled');
                    rellenarSelectAsignaturaPorCursos(1, $('#selectEspecialidad').val());
                });

                $('#selectCurso').change(function() {
                    rellenarSelectAsignaturaPorCursos($('#selectCurso').val(), $('#selectEspecialidad').val());
                    $('#selectAsignatura').removeAttr('disabled');
                });

                $('#selectAsignatura').change(function() {
                    rellenarTablaHorario($('#selectAsignatura').val());
                });

            });

        </script>

        <title>gestHora: Búsqueda de asignaturas</title>

    </head>

    <%
        String URL = "";

        /* Si el usuario está logueado permite entrar a la vista */
        if (UsuarioBean.getRol().equals("secretario")) {
    %>

    <body>

        <div class="contenedor">

            <jsp:include page="/jsp/views/header.jsp"/>

            <div class="contenido">
                <div class="contenido-dentro">                    
                    <div class="contenido-principal" role="main">

                        <jsp:include page="/jsp/views/menu.jsp"/>

                        <div id= "breadcumbs"  >

                            <a href="/gestHora/jsp/views/gestionUsuarioViewIndice.jsp">Inicio</a>
                            &#8594;
                            Búsqueda de asignaturas


                        </div>

                        <section class="contenido-articulo">

                            <h2>Búsqueda de asignaturas</h2>
                            <br/>
                            <% if (MsgBean.getMsg().equals("")) {%>
                            <p>Aquí puede ver el horario de cada una de las asignaturas.</p>
                            <br/>

                            <form class="formVistas" id="formBusqueda" action="javascript:void(0);">
                                <label for="selectEspecialidad">Especialidad: </label><select id='selectEspecialidad' name='selectEspecialidad'>
                                    <option value='null' selected>Seleccione una especialidad</option>
                                </select><br/>
                                <label for="selectCurso">Curso: </label><select id='selectCurso' name='selectFiltarCurso' disabled="disabled"></select><br/>
                                <label for="selectAsignatura">Asignatura: </label><select id='selectAsignatura' name='selectAsignatura' disabled="disabled"></select><br/><br/>
                            </form>


                            <table id='tablaView' class = 'tablaView'><thead><tr><th >Hora/Fecha</th><th>Lunes</th><th>Martes</th><th>Miércoles</th><th>Jueves</th><th>Viernes</th></tr></thead>
                                <tbody>
                                    <tr><th>8:00</th><td>-</td><td>-</td><td>-</td><td>-</td><td>-</td></tr>
                                    <tr><th>9:00</th><td>-</td><td>-</td><td>-</td><td>-</td><td>-</td></tr>
                                    <tr><th>10:00</th><td>-</td><td>-</td><td>-</td><td>-</td><td>-</td></tr>
                                    <tr><th>11:00</th><td>-</td><td>-</td><td>-</td><td>-</td><td>-</td></tr>
                                    <tr><th>12:00</th><td>-</td><td>-</td><td>-</td><td>-</td><td>-</td></tr>
                                    <tr><th>13:00</th><td>-</td><td>-</td><td>-</td><td>-</td><td>-</td></tr>
                                    <tr><th>14:00</th><td>-</td><td>-</td><td>-</td><td>-</td><td>-</td></tr>
                                    <tr><th>16:00</th><td>-</td><td>-</td><td>-</td><td>-</td><td>-</td></tr>
                                    <tr><th>17:00</th><td>-</td><td>-</td><td>-</td><td>-</td><td>-</td></tr>
                                    <tr><th>18:00</th><td>-</td><td>-</td><td>-</td><td>-</td><td>-</td></tr>
                                    <tr><th>19:00</th><td>-</td><td>-</td><td>-</td><td>-</td><td>-</td></tr>
                                    <tr><th>20:00</th><td>-</td><td>-</td><td>-</td><td>-</td><td>-</td></tr>
                                </tbody></table>


                            <% } else {%>
                            <a class="volver" href="/gestHora/jsp/views/gestionHorarioView.jsp"> &#8592; Volver atrás</a><br/>

                            <p><%=MsgBean.getMsg()%></p>                            


                            <% MsgBean.setMsg("");%>

                            <% }%>

                        </section>

                    </div>
                </div>

                <jsp:include page="/jsp/views/footer.jsp"/>

            </div>
        </div>

    </body>
</html>


<%} /* En caso de que el usuario no esté logueado muestra un mensaje de error */ else {
        MsgBean.setMsg("No tiene permisos para visualizar esta página. Inicie sesión con un usuario con privilegios.");
        URL = "/error.jsp";

        response.sendRedirect("/gestHora" + URL);

    }%>
